package com.briup.jdbc;


import java.sql.Connection;
import java.sql.DriverManager;

/**
 * 获取连接对象
 */
public class Test2 {
    public static void main(String[] args) throws Exception {
        // 注册驱动，让mysql的驱动类完成类加载过程
        Class.forName("com.mysql.cj.jdbc.Driver");
        // 建立连接
        String url = "jdbc:mysql://127.0.0.1:3306/briup";
        String username = "root";
        String password = "rootroot";
        Connection connection = DriverManager.getConnection(url, username, password);
        System.out.println("connection = " + connection);
    }
}
